home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
076-100
/
disk_098
/
hddriver
/
readme
< prev
next >
Wrap
Text File
|
1992-05-06
|
6KB
|
127 lines
Driver Information
==================
These comments are totally scrambled. Hope it makes some sense.
Oh well, what do you expect for free?
This driver was written for a WD-1002-05 hard disk controller card.
This card can handle 3 hard disks and 4 floppies, but my driver can
handle only one hard disk.
The driver was written for Aztec C 3.4a. I dont know how hard it would be
to port to Lattice.
The article in this directory was printed in the Workbench newsletter
published by AUG (the Amiga User Group inc. in Melbourne Australia).
It may contain a few inaccuracies as it was written a long time before
this version of the driver. In particular it does not handle autoloading.
It does however give an introduction to the EXEC and message passing.
To use the driver, "harddisk.device" must be copied into your devs:
directory and the MountList file modified for your hard disk. I
use 4 partitions but I am not sure why. Stops the C: directory being
scattered all over the disk I guess. Also I can back up one partition
in another if I want to.
The directory "driver" contains the actual hard disk device driver.
The "support" directory contains support routines (such as to format
the hard disk and to later analyse it). The "driver" directory must
be compiled before the "support" directory.
The support directory contains a general purpose initiate/read/write
program for the hard disk. You must run initiate with the f option
usage: initiate logfile commands [inputfile]
The logfile just keeps track of what is going on (I usually used PRT:).
Commands is a string of characters. Legal characters are 'f' 'r' 'w'.
The 'f' option requires the optional input file which specifies
which sectors are bad (the WD-1002-05 controller card does not do
automatic bad sector removal). I probably should have mapped out
bad tracks to reduce the size of the map table, but with sectors
it should be possible to write a utility to unlink a bad sector from
an already formatted hard disk. The 'r' and 'w' options read or
write to the whole disk. If any bad sectors are detected in any of
the commands, the sector is relinked (via a table in the first sectors
of the disk - see struct hd_FirstSector in harddisk.h). Sectors
are removed from the beginning of the disk, so in your MountList
file, YOU MUST NOT USE SECTORS NEAR THE BEGINNING OF THE DISK!!!
I left 10 cylinders for future errors.
To format my disk I used
initiate PRT: frwr disk_info
This formatted the disk (using the details in disk_info) then read
the whole disk, wrote the whole disk, and re-read the whole disk.
THIS TAKES A VERY LONG TIME AND CANNOT BE ABORTED OR ELSE THE BAD
SECTOR MAP WILL NOT BE UPDATED ON THE DISK. You may wish to do
several commands one after the other.
The "readdisk" program just reads the whole disk reporting errors.
It never modifies the disk.
The "interleave" program tries different interleave factors and times
the access speeds. This should be done before formatting the disk.
If it says an interleave factor of say 5, I would advise using a larger
one as there are extra delays inserted by AmigaDOS. Perhaps you should
first format a very small partition and try out some different interleave
factors with AmigaDOS.
This version of the code is all interrupt driven. It assumes that
interrupt level 2 is used. I used to have it so it would busy wait
with a Delay(1L) call in the loop so it would not hog the CPU.
This works, but is obviously not as good.
I could not stop the linker wanting _main() so I ended up writing
my own dummy main. This is strange as I have defined my own .begin.
Perhaps I am using some globals from the library or something?
The support routines have not been tested for a while as they could
change my hard disk and I have got all my software on it! I think
they should work ... they link and did work at one stage (when I was
formatting my disk).
CACHING
=======
I have tried three caching algorithms. The different schemes had a very
small effect on the end speed of the system. AmigaDOS is just putting
such a huge overhead on everything.
The first scheme does no caching at all. One big problem I found was
that if you ran two programs at once, it read one sector from the
first file, then one sector from the second, then one from the first
and so on. This resulted in the disk seeking up and down for ages.
(this also happens with floppies). To overcome this, I had a look
inside the sector structure. AmigaDOS links all its sectors together
in a chain. To stop thrashing, I implemented a caching scheme
which attempted to identify sequential reads from a file and
when detected, the driver would read a number of pages for the
file (by following the next pointer links in the sectors).
This meant that it would read large chunks of one of the files
before going to the second. Later calls for the first file
did not require a seek. I also buffered all write commands
and sorted them. If the disk ever seeked past a track with
a buffered write, it did the write on the way past.
This caching was non-trivial but worked quite well. It however did
not help with directories. As a result of looking at how AmigaDOS
places sectors on the disk, I rewrote the caching algorithm to buffer
the last 10 tracks accessed. This worked much better. When multiple
programs were run together track buffers would load 17 sectors for
each track (AmigaDOS allocates sectors for files by track) which
would hopefully be useful later on. This type of buffering also
helps a lot with directory entries. I tried to improve the driver
by buffering directory entries more than normal sector entries.
This is because I considered it more likely to do multiple directory
commands than to re-load the same file multiple times.
If you are going to run a command a lot, you should probably put
it in your ram disk anyway. This time, I did not bother caching
disk write commands so the disk can still thrash if two programs
write to the disk at the same time.
Well, I hope this has been of some help.
Please let me know if you find any errors.
The code is all copyright. I grant full permission for individuals
to use it for what ever they want, but if someone wants to use
it and make money from it, they will have to contact me first.
Alan Kent